High-fidelity photonic quantum logic gate based on near-optimal Rydberg single-photon source

Compared to other types of qubits, photon is one of a kind due to its unparalleled advantages in long-distance quantum information exchange. Therefore, photon is a natural candidate for building a large-scale, modular optical quantum computer operating at room temperature. However, low-fidelity two-photon quantum logic gates and their probabilistic nature result in a large resource overhead for fault tolerant quantum computation. While the probabilistic problem can, in principle, be solved by employing multiplexing and error correction, the fidelity of linear-optical quantum logic gate is limited by the imperfections of single photons. Here, we report the demonstration of a linear-optical quantum logic gate with truth table fidelity of 99.84(3)% and entangling gate fidelity of 99.69(4)% post-selected upon the detection of photons. The achieved high gate fidelities are made possible by our near-optimal Rydberg single-photon source. Our work paves the way for scalable photonic quantum applications based on near-optimal single-photon qubits and photon-photon gates.


I. SUPPLEMENTARY NOTE 1: SINGLE-PHOTON EFFICIENCY AND PURITY
In this section, we present the characterization of our single-photon source efficiency and purity. To characterize the efficiency of our Rydberg single-photon source, we create Rydberg excitation by driving a collective Rabi oscillation between states |G⟩ and |R⟩, and measure η d , the probability of detecting a single photon per experimental cycle. Supplementary Figure 1 displays η d as a function of the Rabi oscillation driving time t, at the repetition rate of 20 kHz. As a result of Rydberg blockade among N atoms, the two-photon Rabi frequency is collectively enhanced by a factor of √ N . The effective number of atoms N ≈ 440 is extracted from a fit to the data in Supplementary Figure 1. With a π-excitation, a peak probability of photoelectric detection η d = 0.1035 (5) is obtained by averaging the number of photon counting events registered by the SPCM during every single-photon readout. Considering the SPCM detection efficiency ξ d = 0.73 (1) and the overall optical transmission ξ t = 0.47 (2), which includes the losses of optical elements, AOM diffraction efficiency and fiber coupling efficiency, we estimate the single-photon generation efficiency η = η d /(ξ t ξ d ) = 0.30 (1). The single-photon generation rate R is proportional to η and the experimental repetition rate. Higher repetition rate can increase R but also reduce the generation efficiency η due to atomic loss. Single-photon generation rate as high as R = 5.42(24) × 10 4 s −1 can be achieved with a repetition rate of 200 kHz. The single-photon generation efficiency is currently limited by the finite matter-light quantum conversion efficiency and by the decoherence during the Rydberg excitation and storage. The matter-light conversion efficiency can in principle be improved by increasing the OD. However, high density could cause severe density-dependent dephasing. Indeed, we have observed a faster dephasing rate with higher atomic density in the current experiment. Ideally, integrating the experiment with a low to medium finesse optical resonator could improve the conversion efficiency while maintaining a low atomic density and longer coherence times.
The high purity of our single photons is guaranteed by the strong van der Waals interactions between the highlying Rydberg atoms which effectively suppress multiple excitations within the blockade radius r b . For the Rydberg state |90S 1/2 , J = 1/2, m J = 1/2⟩ used in the experiment, the blockade radius is r b ≈ 15 µm. The waists of the Rydberg excitation and dipole trap beams are chosen such that the entire excitation region is within the Rydberg blockade radius and only single excitation is allowed. To characterize the purity of the generated single photons, a Hanbury Brown-Twiss (HBT) experiment is performed to measure the second-order intensity correlation function at zero delay g (2) (0) of the single photon. The read-out laser converts the Rydberg single excitation into a high-quality single photon, which is coupled into a 50:50 fiber beam splitter and detected by a pair of SPCMs with lower darkcount rates. The quantum statistics of the single-photon field is then obtained by analyzing the distribution of the photoelectric detection events g (2) (τ ) = p 12 (τ ) p 1 (0)p 2 (τ ) , where p 1 and p 2 are the photoelectric detection probabilities of each SPCM, and p 12 (τ ) is the probability of coincidences between two SPCMs with delay τ . The value of second-order intensity correlation function at zero delay, g (2) (0), is a direct measure of single-photon purity, since g (2) (0) is zero for an ideal single photon. Besides residual multiphoton events, background detection events also contribute to the non-zero g (2) (0) measured in the HBT experiment. In order to suppress the background detection events to SPCMs dark-count level, we employ a pair of PBSs for polarization filtering, a 12.5 nm bandwidth filter and a Fabry-Perot etalon for frequency filtering, and a single-mode fiber for spatial filtering, which bring extra loss of about 0.62 (3). To further increase the signal-to-background ratio of photoelectric detection, a 200 ns detection gating window, which contains 94 % of photons around the center, is applied to reduce the dark counts per trial. The measured second-order intensity correlation function at zero delay is g (2) (0) = 7.5(6) × 10 −4 , indicating near-unity single-photon purity. Given that the probability of coincidences between two background detection events is negligible, the contribution of background detection events to g (2) (0) is where p B 1 and p B 2 are the probabilities of background detection events for the SPCMs. Considering the contribution from background detection events, we extract the background-corrected second-order intensity correlation function g (2) cor (0) = 4.8(6) × 10 −4 .

II. SUPPLEMENTARY NOTE 2: SINGLE-PHOTON INDISTINGUISHABILITY
In this section, we present detailed description and analysis of Hong-Ou-Mandel (HOM) experiment to investigate the two-photon quantum interference and characterize the photon indistinguishability.
The two photons used in the HOM experiment are sequentially generated from the Rydberg atoms with an interval of 5 µs, and temporally matched by a polarization switching electro-optic modulator (EOM) and a 1 km delay fiber (See Supplementary Figure 2). Good temporal mode-matching between the two-photon wave packets is a prerequisite Supplementary Figure 2. Timing sequence for HOM experiment. The single-photon generation protocol is executed twice in every experimental cycle with a delay of 5 µs. To ensure the temporal wave-packet matching of two photons, a polarization switching EOM and a 1 km fiber are used to delay the first photon by 5 µs. The temporal mismatch ∆t between two photons is varied to measure the HOM dip in Fig. 2b.
for high interference visibility. We characterize the temporal mode-matching with a wave-packet overlap function where ψ 1 (t) and ψ 2 (t) are the temporal mode functions of two photons, and I 1 (t) and I 2 (t) are their intensity distributions over time. We measure I 1 (t) and I 2 (t), and obtain a wave-packet overlap function with the value of 99.946(8) % for 200 ns detection window and 99.970(11) % for 80 ns detection window. Moreover, we analyze the wave-packet overlap function with a temporal mismatch ∆t, ( ∫ √ I 1 (t)I 2 (t + ∆t)dt) 2 , and find its dependence on ∆t can be well approximated with a Gaussian function, which is also used to fit the data in Fig. 2b in the main text. Figure 3. Experimental setup of the Hong-Ou-Mandel interference. Two photons in orthogonally polarized states |H⟩ and |V⟩ are combined on the PBS 1 and transformed to circularly polarized states |L⟩ and |R⟩ before PBS 2. Four Glan-Taylor polarizers are employed to ensure high polarization extinction ratios. A pair of SPCMs are used to measure the two-photon interference visibility.

Supplementary
Having two single photons with an excellent temporal overlap at hand, we proceed to the implementation of the HOM experiment, as shown in Supplementary Figure 3. In order to fine tune the beam splitting ratio to be precisely 50:50, we build a HOM setup in which two single photons with orthogonal circular polarizations interfere at a PBS. Using Glan-Taylor polarizers, two single photons are prepared in linearly polarized states |H⟩ and |V⟩ with high polarization extinction ratios and then combined at PBS 1. After being rotated to circularly polarized states |R⟩ and |L⟩, two single photons interfere at PBS 2 and are detected by a pair of SPCMs. Two more Glan-Taylor polarizers and single-mode fibers (not shown) are used before the SPCMs to suppress the polarization crosstalk and provide spatial filtering, respectively.
The HOM interferometer establishes an input-output relation of (t whereâ L (â R ) represents the left (right) circularly polarized input mode, andt H (r V ) represents the transmitted (reflected) output mode. When two single photons with left and right circular polarizations arrive at PBS 2 simultaneously, the HOM interference results in a transformation ofâ † Ideally, two single photons should appear together at the same output port, and the probability of coincidence between different ports should be zero. However, background detection events, single-photon impurity, photon indistinguishability and imperfections of optical components lead to non-zero coincidences, and thus reduce the HOM interference visibility.
As mentioned in the main text, we find that the reduction of indistinguishability from the unit at zero delay is mainly due to the imperfect interference from photon components in the rising and falling edges of the single-photon temporal profile. Here, we study this effect by performing the HOM experiment with different photon detection windows T d , as shown in Supplementary Figure 4. Our single photon has a temporal profile with a full width at half maximum (FWHM) of about 100 ns. As the detection window decreases from 200 ns to 80 ns around the center, the HOM visibility (indistinguishability) at zero delay is improved from 99.43(9) % (99.55(9) %) to 99.87(8) % (99.94(8) %), although their wave-packet overlap function has a negligible difference. These results suggest the possibility of the phase chirps in the rising and falling edges of the single-photon temporal profile. With the 80 ns detection window, 62 % of the photons in the single-photon wave packet are detected and the g (2) (0) is improved from 7.5(6) × 10 −4 (200 ns window) to 4.5(6) × 10 −4 due to a better signal to background ratio. From a single-photon application point of view, it is ideal to apply a proper detection window that: (1). gives high signal-to-background ratio, photon purity and interference visibility; (2). contains a large percentage of the photons. Therefore, we use the 200 ns detection window for most of the single-photon characterization measurements and employ the 80 ns detection window for the implementation of the CNOT gate. In principle, the imperfect interference in the edges can be compensated, so a larger detection window and higher single-photon detection efficiency can be achieved. While the photon counting measurement employed here only gives the amplitude distribution of the single-photon wave packet, a homodyne detection setup could provide the complex temporal profile of the single photon, including the phase information. We plan to implement such a homodyne detection protocol to extract phase distribution inside the single-photon profile to investigate the possible phase chirps. The phase chirps can in principle be compensated by optimally controlling the phase of the 479 nm read-out field. However, it goes beyond the scope of the current work.

Supplementary
Now we proceed to the analysis of HOM interference visibility with 80 ns detection window. The visibility of HOM quantum interference is given by V (t) = 1 − C(t)/C(∞), where C(t) is the measured probability of twophoton coincidence with a temporal delay t, and C(∞) is the expected probability of coincidence if two photons are completely distinguishable. We evaluate C(∞) by inputting the left and right circularly polarized single photons separately. From the photoelectric detection probabilities of the transmitted (reflected) photons p L t = 0.006275 (20) (p L r = 0.006576 (21)) and p R t = 0.002281(12) (p R r = 0.002406(13)), we have C(∞) = p L t p R r + p L r p R t = 3.010(13) × 10 −5 . At zero temporal delay, we obtain a minimal probability of coincidences C(0) = 4.0(23) × 10 −8 and a maximal HOM interference visibility V (0) = 99.87 (8) %. Next, we analyze the major mechanisms that cause reduction of the HOM interference visibility, and extract the indistinguishability of our Rydberg single-photon source.
Visibility reduction due to background detection events. The background detection events, which mainly consist of dark counts from SPCMs, contribute to the undesired coincidences in the HOM experiment. Similar to the analysis in Section I, the probability of detecting coincidence caused by background per experimental trial is where p t (p r ) represents the photoelectric detection probability of the transmitted (reflected) photons and p B t (p B r ) is the probability of background detection events from the SPCM in the transmitted (reflected) output port. These undesired coincidences decrease the HOM interference visibility from unity by where p t = 0.008280 (11), p r = 0.008671 (11), p B t = 4.7(18) × 10 −7 and p B r = 7.3(22) × 10 −7 . Visibility reduction due to single-photon impurity. The multi-photon components of our single-photon source, characterized by g (2) (0), also cause a reduction of interference visibility. The multi-photon components increase the probability of coincidence by where the third expectation value is zero since the phases of two input modesâ L andâ R are unrelated. The reduction of interference visibility due to multi-photon components is then given by Here, η L (η R ) is the probability of having a photon in the input modeâ L (â R ), and the intensity ratio between them is η L /η R = 2.045(3). Since the two single photons used in the HOM experiment are generated from the same source, R (0), which is measured in Section I with the value of 2.9(8) × 10 −4 . Visibility reduction due to imperfect optical elements. The imperfections of optical elements in the HOM experiment also contribute to the measured coincidences. The imperfections of half-wave plates (HWP) and quarterwave plates (QWP) induce a deviation of the interferometer beam splitting ratio from 50:50, characterized by ϵ q , and lead to a modified input-output relation Additionally, the finite extinction ratios of transmission and reflection at PBS 2, denoted by 1 : ϵ 2 t and 1 : ϵ 2 r , result in a polarization crosstalk between two output modes. The above-mentioned imperfections reduce the HOM interference visibility by where ϵ q = 0.0049(37), ϵ r = 0.001186(2) and ϵ t = 0.000730(1) are measured with coherent laser light. Photon indistinguishability. In order to characterize the indistinguishability of two input photons, we introduce an additional right circularly polarized modeâ ′ R , which does not interfere withâ L , and rewrite the input modeâ R as where ϵ d quantifies the two-photon distinguishability. The HOM intereference visibility reduction due to the distinguishable input modeâ ′ R is given by wheret ′ H (r ′ V ) is the transmitted (reflected) distinguishable output mode. By subtracting the visibility reduction due to background detection events (0.034(8) %), single-photon impurity (0.036(10) %), and imperfect optical elements (0.005(7) %) from the measured HOM interference visibility V (0) = We also analyze the HOM data for 200 ns detection window. Besides finite photon indistinguishability, the HOM visibility is also reduced by the following sources: 0.051(7) % from the background, 0.061(10) % from single-photon impurity, and 0.005(7) % from the imperfect optical elements. From the measured HOM visibility V (0) = 99.43(9) %, we extract a indistinguishability of 1 − ϵ d = 99.55(9) % for 200 ns detection window. We summarize the results in Supplementary Table 1.
However, realizing high-fidelity two-photon quantum logic gates remains elusive due to the lack of perfect singlephoton sources. For example, to realize a quantum logic gate with fidelity approaching 99 % using the interferencebased CNOT gate protocol, the minimum requirements on the single-photon source are g (2) (0) < 7 × 10 −3 and indistinguishability higher than 99 %. To date, single-photon source that simultaneously reaches such demanding goals on purity and indistinguishability has not been demonstrated. Physical platforms that hold the promise for generating such near-perfect single photons include quantum dots 20-23 , spontaneous parametric down-conversion 24-26 , spontaneous four-wave mixing 27,28 , nitrogen-vacancy centers 29-31 , neutral atoms 32-43 , trapped ions 44-47 , etc. With a 80 ns detection window, our Rydberg single-photon source shows g (2) (0) = 4.5(8) × 10 −4 and indistinguishability of 99.94(8) %, and results in a photon-photon quantum logic gate with a high fidelity. Supplementary Table 2 summarizes the experiments that demonstrated linear-optical gates over the past two decades, and Supplementary Figure 5 displays the achieved truth table and entangling gate infidelities on a logarithmic scale. The infidelities in our work are suppressed by more than a order of magnitude compared to previous studies.
In the remainder of this section, we analyze the detailed implementation of the CNOT gate, and investigate the major sources of error that affect the truth table fidelity in the experiment. As shown in Supplementary Figure 6, the CNOT gate establishes quantum correlations between the control and target photons by interfering them at a partial polarization beam splitter (PPBS), which has a reflectivity of 1/3 (1) for horizontally (vertically) polarized photons. For an input state of |HH⟩, unlike a HOM interferometer which completely eliminates |HH⟩ state at the output, the PPBS-based photon-photon interferometer generates an output state with π-phase shift : −1/3 |HH⟩, due to the unbalanced destructive interference caused by the partial reflection. By encoding the qubits with scheme shown in Supplementary Table 3 and combing the controlled π-phase shift mechanism with two more PPBSs for amplitude compensation, the two-photon CNOT gate operation can be executed [11][12][13][14][15][16][17][18][19] . Figure 6. Schematic illustration of the CNOT gate apparatus. The CNOT gate experimental setup consists of state preparation, the gate operation and the state measurement.

Supplementary
In order to analyze various gate errors, we model the CNOT gate protocol in detail. As shown in Supplementary Figure 6, the gate operation transforms the input optical modesĈ H ,Ĉ V ,T H andT V to the output modesĉ H ,ĉ V , t H andt V , where symbolsĈ (T ) andĉ (t) represent the input and output modes of the control (target) arm, and the subscript H (V) indicates a horizontally (vertically) polarized mode. To balance the amplitudes of the output modes, two more PPBSs and HWPs are employed after the two-photon interference. To describe the effects of these two PPBSs, ancillary input and output modes ofĈ X H (T X H ) andĉ X H (t X H ) are introduced. The detailed input-output transformation is described by Control Target 2 as the input qubits. The output qubits are encoded asĉ 0 \ĉ 1 Assisted by the non-classical interference between two indistinguishable single photons, the transformation in Sup-plementary Equation (10) establishes quantum correlations between the control and target photonic qubits. After the interference, two single photons could end up in three scenarios: (i) a single photon occupies one of the control modes and the other occupies one of the target modes, (ii) both single photons appear in the control or target modes, (iii) one or two single photons leak to the ancillary modes. The coincidence detection events between the control and target output qubits only occur in scenario (i). By post selecting these events, a CNOT operation on the input photons is implemented in terms of the encoding displayed in Supplementary Table 3, and the operation can be described as In addition to the truth table in computational ZZ basis, we also measure the truth table in complementary XX basis, defined by |±⟩ C = (|0⟩ C ± |1⟩ C )/ In the following, we analyze the major sources of error that contribute to the infidelities: background detection events, single-photon impurity, imperfect photon indistinguishability, and imperfections of optical components.
Infidelities from background detection events. One of the error contributions comes from the background detection events, which are dominated by the SPCM dark counts. The probability of error for each combination of input-output states are approximated to the first-order and shown in Supplementary Table 4. Several notations are introduced to denote various probabilities in each experiment cycle. When the input state is |ij⟩, p ) is the background detection probability of SPCM corresponding to output state |m⟩ c (|n⟩ t ), where i, j, m, n = 0, 1 in ZZ basis and i, j, m, n = +, − in XX basis. We estimate that the errors due to the background detection events add up to infidelities of ∆F ZZ bg = 0.088(4) % for ZZ basis and ∆F XX bg = 0.077(4) % for XX basis. Infidelities from single-photon impurity. As a result of the single-photon impurity, there are residual multiphoton components from our single-photon source, which also reduce the truth table fidelity. In the measurement of truth table in ZZ basis, this error mechanism depends on the state of control qubit. When the control qubit is in state |0⟩ C , the photons from modeĈ 0 can only end up in modeĉ 0 and do not contribute any coincidences. However, the modeT j=0,1 is allowed to transform to bothĉ 1 andt j modes. Multi-photon events inT j mode result in an error in the element |0⟩ C |j⟩ T → |1⟩ c |j⟩ t of the truth table T (0) = 6.0(17) × 10 −4 .
Here, the factor 1/9 is the success probability of the CNOT operation (derived from Supplementary Equation (11)), and the denominator is the probability of two-photon inputs. The η C (η T ) is the probability of having a photon in the control (target) arm, and η T /η C = 2.11(4) is measured with coherent laser light. When the control qubit is in state |1⟩ C , photons from input modeĈ 1 go to output modesĉ 1 ,t 0 andt 1 . The multi-photon components from input modeĈ 1 orT j lead to an error in the element |1⟩ C |j⟩ T → |1⟩ c |j⟩ t of the truth table Here, g T (0) = 2.9(8) × 10 −4 is determined in Section I. Considering the gate errors in Supplementary Equations (12) and (13), the infidelity from multi-photon components for ZZ basis is given by T (0) = 0.067(19) %.
The difference between the measurements of truth tables in XX and ZZ bases is that the polarization bases of the control and target qubits are exchanged. Thus, we can derive that the contributed infidelity for XX basis is T (0) = 0.044(12) %.

Supplementary Table 4. Error contribution of background detection events to each element of the truth tables for ZZ and XX bases.
Infidelities from photon distinguishability. To analyze the infidelity due to imperfect photon indistinguishability, similar to Section II, we introduce additional modesT ′ j=0,1 to characterize the distinguishable components between the control and target photons. The target modes can be written as where the distinguishability ϵ d is defined in Section II. In the measurement of the truth table in ZZ basis, the two-photon interference occurs only when the control qubit is in state |1⟩ C . The existence of the distinguishable input modeT ′ j deteriorates the interference and causes an error in the element |1⟩ C |j⟩ T → |1⟩ c |j⟩ t of the truth table   9 ⟨t whereĉ ′ 1 andt ′ j are the distinguishable output modes. By averaging the errors described in Supplementary Equation (16) when the control qubit is in |1⟩ C and the zero errors when the control qubit is in |0⟩ C , the distinguishability contributed infidelity is given by ∆F ZZ d = ϵ d = 0.06(8) %. For XX basis, this contribution is the same. Infidelities from imperfect optical elements. We analyze the imperfections of optical components in state preparation, gate operation and state measurement stages separately. In the state preparation stage, considering the imperfections of HWPs and the finite resolutions of our polarization calibrations (limited by the polarimeter), ϵ C (ϵ T ) is introduced to characterize the polarization state error of the control (target) qubit. Therefore, we redefine the encoding of the input qubits (see Supplementary Table 3) as In the gate operation stage, the main imperfections come from the three PPBSs. We denote the reflectivity of each PPBS as (1 − ϵ Hi )/3 for horizontally polarized components instead of the ideal value 1/3, and (1 − ϵ 2 Vi ) for vertically polarized components instead of 1, where i = 0 corresponds to the PPBS for two-photon interference, and i = 1, 2 correspond to the PPBSs in the control and target arms, respectively. Combining with Supplementary Equation (17), we derive the transformation matrix of the CNOT gate approximated to the first-order as In the state measurement stage, the imperfections of HWP and PBS in the control (target) arm cause polarization crosstalk between two output control (target) modes. The single photons in modeĉ 1−j (t 1−j ) could end up in the SPCM corresponding to modeĉ j (t j ) with an error probability denoted as ϵ 2 cj (ϵ 2 tj ), where j = 0, 1. The abovementioned imperfections contribute infidelities of for ZZ basis, and for XX basis, where ϵ V0 = 0.0080(1), ϵ H0 = 0.0000(51), ϵ H1 = 0.0000(60), ϵ H2 = 0.0000 (48), ϵ C = 0.0000 (19), To further improve the gate fidelity, one can increase the single-photon efficiency to get a better signal-to-background ratio, use a smaller atomic sample and higher principal quantum number to suppress multi-photon events, and apply quantum optimal control techniques to optimize photon indistinguishability. With these improvements, it is possible to achieve CNOT gate fidelity above 99.9 % in our system. In our current experiment, the limitations of success probability come from the intrinsic gate efficiency, the singlephoton generation efficiency, a series of optical losses and SPCM detection efficiency. Specifically, the intrinsic efficiency is 1/9, and the single-photon generation efficiency in the CNOT experiment is 0.27. Besides, the overall optical transmission for the target (control) qubit is 0.25 (0.13). The detection efficiency of low-noise SPCMs is about 0.58. Moreover, the 80 ns detection window leads to an extra photon loss of 38 %. Considering the above limitations, our gate detection success probability is about 3.3 × 10 −5 with an 80 ns detection window, and the success rate of the gate is up to 100/min with a repetition rate of 50 kHz. We also study the gate performance with 200 ns detection window and find a truth table fidelity of F ZZ CNOT = 99.53(3) % (F XX CNOT = 99.40(3) %). The success probability and success rate of the gate are 7.6 × 10 −5 and 230/min, respectively.
We emphasize that the main focus of our work is to achieve high gate fidelity, and we didn't spend efforts on optimizing the efficiencies. Especially, the losses in single-photon efficiency are not fundamental to our experiment and can in principle be alleviated in the future. The single-photon generation efficiency can be further improved, potentially to near unity by incorporating an optical resonator. In the current experiment, no serious efforts have been spent on minimizing the optical losses, which can be alleviated by replacing the optical elements with high transmission and removing some of the optical components used for switching photon paths between different experiments. The detection efficiency can be increased by using superconducting nanowire single-photon detectors (SNSPD). The 38 % photon loss from the 80 ns small detection window is caused by the imperfect interference between the photon components in the edges. We can implement optimal control techniques to the 479 nm read-out field to compensate the imperfect interference and achieve near-unity indistinguishability with the full single-photon wave-packet.

IV. SUPPLEMENTARY NOTE 4: ENTANGLEMENT GENERATION, QUANTUM STATE TOMOGRAPHY AND VIOLATION OF BELL'S INEQUALITY
In this section, the quantum nature of our photon-photon gate is benchmarked by measuring the entangled state fidelity and demonstrating the violation of Bell's inequality. Various error mechanisms that decrease the fidelity and Bell parameter from the ideal values are also thoroughly investigated.
The ability to generate entanglement distinguishes our quantum logic gate from its classical counterpart. The maximally entangled Bell state The fidelity of the output state ρ relative to |Ψ − ⟩ is where σ x , σ y and σ z are Pauli matrices. We perform a complete quantum state tomography and apply maximum likelihood estimation technique to reconstruct the full density matrix of the output state. The reconstructed density matrix gives a fidelity of F Ψ − = 99.69(4) %, where the standard deviation is given by a Monte Carlo method. The near-unity value for F Ψ − provides a benchmark for the fidelity of our entangling-gate operation and demonstrates the preparation of high-quality entangled photon pairs, which are critical for a number of quantum applications.
To further verify the entanglement, a Bell's inequality measurement is performed on the output state. Correlations between two output photons are measured at different polarization measurement bases. At linearly polarized bases of {cos θ c |0⟩ c + sin θ c |1⟩ c , sin θ c |0⟩ c − cos θ c |1⟩ c } for control qubit and {cos θ t |0⟩ t + sin θ t |1⟩ t , sin θ t |0⟩ t − cos θ t |1⟩ t } for target qubit, we measure the correlation function of where C ij is the coincidence rate between SPCMs c i=0,1 and t j=0,1 in Supplementary Figure 6, and p(α, β) is the probability of coincidences between output modesĉ α =ĉ 0 cos α +ĉ 1 sin α andt β =t 0 cos β +t 1 sin β. We hence obtain the Bell parameter .

V. SUPPLEMENTARY NOTE 5: POTENTIAL APPLICATIONS
We demonstrate a near-optimal Rydberg atom single-photon source and realize a two-photon quantum logic gate with a high fidelity. Our results provide potential applications in photonic quantum information processing and distributed matter-light quantum architectures, as schematically shown in Supplementary Figure 7. Measurement-based (or one-way) photonic quantum computing 2,67-69 , which requires a large cluster-state as resource 70 , is one of the most promising approaches to realize linear optical quantum computation. However, the main hindrance of the measurement-based photonic quantum computation is to efficiently generate high-fidelity cluster states. Our Rydberg single-photon source and demonstrated entangling gates provide a potential way to overcome this challenge. A collection of high-fidelity entangled Bell states, which are locally equivalent to two-qubit cluster states, can be used to generate a large cluster state by sequentially applying the fusion gates. Furthermore, the success probability of the fusion gate can be boosted by adding more ancillary single photons 71 . As an example, a threedimensional cubic cluster state that allows for fault-tolerant photonic quantum computation 72,73 can be generated based on our system. Achieving long-distance quantum communication 74,75 is very challenging. Due to the photon loss, the efficiency of quantum communication decreases exponentially with the communication distance. Quantum repeaters are thus introduced to beat the exponential scaling with the distance 76 . In the standard paradigm, a quantum repeater requires a quantum memory with a sufficiently long coherence time 76 . Alternatively, an all-optical quantum repeater circumvents the need for matter quantum memories by employing optical cluster states and single-qubit measurements 4 . Proof-of-principle experimental demonstrations of all-optical quantum repeaters have been realized using single photons prepared by spontaneous parametric down-conversion 5,77 and solid-state quantum emitters 78 . Our device can generate on-demand single photons and high-quality entangled photon pairs, which are building blocks for optical cluster states. Therefore, our Rydberg atom single-photon source and photon-photon gate play a central role in an all-optical quantum repeater and would be a key ingredient of the quantum internet.
A photonic chip provides a stable platform which can integrate a large number of reconfigurable optical components 54,60,62,79,80 . It is in principle possible to integrate all constituent parts that are required for photonic quantum information processing in a single chip 27,80-83 , including single-photon sources, linear optical circuits and photon detec-tors. However, it is challenging to maintain the performances of all constituent parts when combining them together. Given that Rydberg atoms can generate near-perfect single photons, it is natural to envision a new architecture which connects our Rydberg single-photon sources with a photonic chip, allowing for multi-photon quantum interference with high visibility. Near-future techniques will potentially enhance the single photon generation efficiency of Rydberg atoms to a level that enables large-scale quantum information processing on photonic chips.
The state-of-the-art quantum module consists of a relatively small number of matter qubits [84][85][86] (superconducting qubits, ion qubits, etc.) that can be precisely manipulated and mutually coupled via high-fidelity entangling gates. Increasing the number of qubits in a single quantum module would degrade the performance of the gate operations 87 . One potential solution is to connect many quantum modules using photons as intermediaries. Quantum correlations (logic gates) between quantum modules can be established (implemented) by either detecting photons emitted from two quantum modules 87 , coupling a single photon sequentially with two quantum modules 88 , or teleporting quantum gate using previously shared entanglement 89 . The overall performance of the quantum network relies critically on the quality of the single photons or entangled photon pairs. Our device therefore enables near-perfect interconnections between quantum modules and reduces the overall error rates of quantum networks 90 .